var cc__decorate = __decorate;
Object.defineProperty(exports, "__esModule", {
  value: true
});
var $2GameUser = require("GameUser");
var $2UIManager = require("UIManager");
var $2UIVMain = require("UIVMain");
var $2ccUtil = require("ccUtil");
var $2GameConfiguration = require("GameConfiguration");
var $2Globe = require("Globe");
var $2levelbase = require("levelbase");
var $2gezi_2 = require("gezi_2");
var $2level_yuan = require("level_yuan");
var Adv_skd=require("./Adv_skd");
var cc__decorator = cc._decorator;
var ccp_ccclass = cc__decorator.ccclass;
var ccp_property = cc__decorator.property;
var p;
var m;
var f;
var y;
(function (t) {
  t[t.qiangs = 0] = "qiangs";
  t[t.qius = 1] = "qius";
  t[t.yidongqiang2 = 2] = "yidongqiang2";
  t[t.childs = 3] = "childs";
  t[t.childs_r = 4] = "childs_r";
  t[t.childs_eff = 5] = "childs_eff";
  t[t.max = 6] = "max";
})(p || (p = {}));
(function (t) {
  t[t.ridgebody = 0] = "ridgebody";
  t[t.gezi_a = 1] = "gezi_a";
  t[t.gezi_b = 2] = "gezi_b";
  t[t.gezi_c = 3] = "gezi_c";
  t[t.gezi_d = 4] = "gezi_d";
  t[t.yuan1 = 5] = "yuan1";
  t[t.yuan2 = 6] = "yuan2";
  t[t.yuan3 = 7] = "yuan3";
  t[t.max = 8] = "max";
})(m || (m = {}));
(function (t) {
  t[t.man = 0] = "man";
  t[t.max = 1] = "max";
})(f || (f = {}));
(function (t) {
  t[t["螺丝钉"] = 0] = "螺丝钉";
  t[t["岩浆"] = 1] = "岩浆";
  t[t.max = 2] = "max";
})(y || (y = {}));
var def_level_game_3 = /* */function (_c$default) {
  function _ctor() {
    var _this13;
    babel_classCallCheck(this, _ctor);
    _this13 = _callSuper(this, _ctor, arguments);
    _this13.SceneArrs = [];
    _this13.SpineArrs = [];
    _this13.ArrPres = [];
    _this13.qiuNum = null;
    _this13.jingdu = null;
    _this13.title = [];
    _this13.skin_spine = [];
    _this13.isget30s = false;
    _this13.zhadan = null;
    _this13.bombani = null;
    _this13.max_qiu = 0;
    _this13.qius = [];
    _this13.CanMoveNodeArrs = [];
    _this13.geziData = [];
    _this13.childs = null;
    _this13.childs_r = null;
    _this13.childs_eff = null;
    _this13.speed_q1 = 5;
    _this13.shitouid = "0";
    _this13.cantouch = false;
    _this13.item_wid = 65;
    _this13.item_hig = 65;
    _this13.map_Width = 9;
    _this13.map_Hight = 10;
    _this13.map_Data = [];
    _this13.skin_cfg1 = [6, 6, 6, 6, 6, 6];
    _this13.curr_skin = "0";
    _this13.curr_rand = 0;
    _this13.initPos = null;
    _this13.startClickTime = 0;
    _this13.curr_nd = null;
    _this13.curr_pos = cc.v2(0, 0);
    _this13.new_nd = null;
    _this13.arr_neibor = [null, null, null, null];
    _this13.deleteNds = [];
    _this13.IsGameOver = false;
    _this13.isStartChange = false;
    _this13.gameTime = 0;
    _this13.moveWay = -1;
    _this13.need_score = 0;
    _this13.need_last = 0;
    _this13.curr_score = 0;
    _this13.speed = .083;
    _this13.is_shan = false;
    _this13.pauseTime = 0;
    return _this13;
  }
  babel_inherits(_ctor, _c$default);
  return babel_createClass(_ctor, [{
    key: "onDisable",
    value: function onDisable() {
      babel_get(babel_getPrototypeOf(_ctor.prototype), "onDisable", this).call(this);
    }
  }, {
    key: "getsjnum",
    value: function getsjnum(t, e) {
      var i = $2Globe.default.getInstance().random(0, 2);
      if (t >= 2) {
        var _s17 = this.geziData[t - 1][e][0];
        var _n16 = this.geziData[t - 2][e][0];
        if (i == _s17 && i == _n16) {
          return this.getsjnum(t, e);
        }
      }
      if (e >= 2) {
        var _s18 = this.geziData[t][e - 1][0];
        var _n17 = this.geziData[t][e - 2][0];
        if (i == _s18 && i == _n17) {
          return this.getsjnum(t, e);
        }
      }
      return i;
    }
  }, {
    key: "onLoad",
    value: function onLoad() {

      Adv_skd.default.instance.hideBannerAd()
      Adv_skd.default.instance.hideGridAdLeftOne()
      Adv_skd.default.instance.hideGridAdRightOne()

      var _this14 = this;
      babel_get(babel_getPrototypeOf(_ctor.prototype), "onLoad", this).call(this);
      if (cc.sys.OS_IOS == cc.sys.os) {
        cc.director.getPhysicsManager().enabledAccumulator = true;
        cc.PhysicsManager.FIXED_TIME_STEP = .04;
        cc.PhysicsManager.VELOCITY_ITERATIONS = 3;
        cc.PhysicsManager.POSITION_ITERATIONS = 3;
      }
      this.childs = this.SceneArrs[p.childs];
      this.childs_r = this.SceneArrs[p.childs_r];
      this.childs_eff = this.SceneArrs[p.childs_eff];
      this.shitouid = $2GameUser.default.getInstance().curr_skin_stone;
      console.log("shitou", this.shitouid);
      this.set_hero();
      this.scheduleOnce(function () {
        _this14.cantouch = true;
      }, 3);
      $2UIManager.UIManager.getInstance().getUI($2UIVMain.default).setContent(false);
    }
  }, {
    key: "set_hero",
    value: function set_hero() {
      var t = $2GameUser.default.getInstance().curr_skin_spine;
      var e = parseInt(t);
      var i = this.skin_spine[e];
      this.SpineArrs[f.man].skeletonData = i;
      this.SpineArrs[f.man].setAnimation(0, "idle", true);
    }
  }, {
    key: "start",
    value: function start() {
      var _this15 = this;
      babel_get(babel_getPrototypeOf(_ctor.prototype), "start", this).call(this);
      this.curr_skin = $2GameUser.default.getInstance().curr_skin;
      var t = "帮助国王脱困 第".concat($2GameUser.default.getInstance().PassLevelNum_yjwj + 1, "关");
      this.title[0].string = t;
      this.title[1].string = t;
      if ($2UIManager.UIManager.getInstance().getUI($2UIVMain.default).currlv != $2GameUser.default.getInstance().PassLevelNum) {
        $2UIManager.UIManager.getInstance().getUI($2UIVMain.default).currlv = $2GameUser.default.getInstance().PassLevelNum;
        this.curr_rand = $2GameUser.default.getInstance().curr_rand;
        this.curr_rand += 1;
        this.curr_rand > 3 && (this.curr_rand = 0);
        $2GameUser.default.getInstance().curr_rand = this.curr_rand;
      }
      for (var _s19 = 0; _s19 < this.map_Hight; _s19++) {
        this.geziData[_s19] = [];
        for (var _t25 = 0; _t25 < this.map_Width; _t25++) {
          var _e17 = this.getsjnum(_s19, _t25);
          this.geziData[_s19][_t25] = [_e17];
        }
      }
      var e = m.gezi_a;
      if ("0" == this.curr_skin) {
        e = m.gezi_a;
      } else if ("1" == this.curr_skin) {
        e = m.gezi_b;
      } else if ("2" == this.curr_skin) {
        e = m.gezi_c;
      } else {
        "3" == this.curr_skin && (e = m.gezi_d);
      }
      var i = 0;
      var _loop = function _loop(_s20) {
        var _loop2 = function _loop2(_t27) {
          _this15.scheduleOnce(function () {
            var n = "".concat(i);
            var a = cc.instantiate(_this15.ArrPres[e]);
            a.parent = _this15.childs;
            a.setPosition(32 + _this15.item_wid * _t27, -32 - _this15.item_hig * _s20);
            a.name = n;
            var r = cc.instantiate(_this15.ArrPres[m.ridgebody]);
            r.parent = _this15.childs_r;
            r.setPosition(32 + _this15.item_wid * _t27, -32 - _this15.item_hig * _s20);
            r.name = n;
            var h = _this15.CanMoveNodeArrs.length;
            _this15.geziData[_s20][_t27][1] = h;
            a.getComponent($2gezi_2.default).id = h;
            _this15.CanMoveNodeArrs[_this15.CanMoveNodeArrs.length] = a;
            var o = _this15.geziData[_s20][_t27][0] + _this15.curr_rand;
            a.getComponent($2gezi_2.default).setColor(o);
            i++;
          }, .1 * _s20);
        };
        for (var _t27 = 0; _t27 < _this15.geziData[_s20].length; _t27++) {
          _loop2(_t27);
        }
      };
      for (var _s20 = 0; _s20 < this.geziData.length; _s20++) {
        _loop(_s20);
      }
      this.childs.on(cc.Node.EventType.TOUCH_START, this.onTouchStart, this);
      this.childs.on(cc.Node.EventType.TOUCH_MOVE, this.onTouchMove, this);
      this.childs.on(cc.Node.EventType.TOUCH_END, this.onTouchEnd, this);
      this.childs.on(cc.Node.EventType.TOUCH_CANCEL, this.onTouchEnd, this);
      this.playPublicSound("shitou");
      this.max_qiu = $2GameConfiguration.default.getGFByType($2GameConfiguration.eGameFeatures.BlockCount, "level3");
      this.need_last = 30;
      this.need_score = this.max_qiu - this.need_last;
      this.scheduleOnce(function () {
        for (var _t26 = 0; _t26 < _this15.SceneArrs[p.qiangs].children.length; _t26++) {
          var _e18 = _this15.SceneArrs[p.qiangs].children[_t26];
          var _i13 = _e18.getPosition().add(cc.v2(-375, -667));
          _e18.setPosition(_i13);
        }
        _this15.schedule(function () {
          _this15.instenceqiu();
        }, 0, _this15.max_qiu - 1);
      });
      this.qiuNum.string = "消除100块石头：0/100";
      this.scheduleOnce(function () {
        _this15.isStartChange = true;
        _this15.SpineArrs[f.man].setAnimation(0, "go2", true);
      }, 2);
    }
  }, {
    key: "instenceqiu",
    value: function instenceqiu() {
      var t = Math.floor(3 * Math.random());
      var e = m.yuan1;
      var i = $2GameConfiguration.eGameFeatures.Model1Info;
      if (0 == t) {
        e = m.yuan1;
        i = $2GameConfiguration.eGameFeatures.Model1Info;
      } else if (1 == t) {
        e = m.yuan2;
        i = $2GameConfiguration.eGameFeatures.Model2Info;
      } else if (2 == t) {
        e = m.yuan3, i = $2GameConfiguration.eGameFeatures.Model3Info;
      }
      var s = cc.instantiate(this.ArrPres[e]);
      s.parent = this.SceneArrs[p.qius];
      s.getComponent(cc.PhysicsCircleCollider).radius = $2GameConfiguration.default.getGFByType(i).radius;
      s.getComponent(cc.PhysicsCircleCollider).restitution = $2GameConfiguration.default.getGFByType(i).resilient;
      s.getChildByName("shikuai").width = $2GameConfiguration.default.getGFByType(i).size;
      s.getChildByName("shikuai").height = $2GameConfiguration.default.getGFByType(i).size;
      var n = 100 * -Math.random() - 100;
      var a = 100 * Math.random() - 100;
      s.setPosition(-60 + n, 550 + a);
      var r = parseInt(this.shitouid);
      s.getComponent($2level_yuan.default).init(r);
      this.qius[this.qius.length] = s;
    }
  }, {
    key: "onTouchStart",
    value: function onTouchStart(t) {
      if (!this.cantouch) {
        return;
      }
      if (this.IsGameOver) {
        return;
      }
      var e = t.getLocation();
      for (var _i14 = 0; _i14 < this.childs.childrenCount; _i14++) {
        var _t28 = this.childs.children[_i14];
        var _s21 = $2ccUtil.default.getPolygon(_t28);
        if (cc.Intersection.pointInPolygon(e, _s21)) {
          this.curr_nd = _t28;
          this.curr_nd.zIndex += 100;
          this.curr_pos = _t28.getComponent($2gezi_2.default).startPos;
          _t28.getComponent($2gezi_2.default).ischoose(true);
          this.playPublicSound("xuanzhong");
          for (var _t29 = 0; _t29 < this.childs.childrenCount; _t29++) {
            var _e19 = this.childs.children[_t29];
            if (_e19 != this.curr_nd) {
              var _t30 = _e19.getPosition();
              if (Math.abs(_t30.x - this.curr_pos.x) < 5) {
                if (_t30.y - this.curr_pos.y > 60 && _t30.y - this.curr_pos.y < 70) {
                  this.arr_neibor[0] = _e19;
                } else {
                  _t30.y - this.curr_pos.y > -70 && _t30.y - this.curr_pos.y < -60 && (this.arr_neibor[3] = _e19);
                }
              }
              if (Math.abs(_t30.y - this.curr_pos.y) < 5) {
                if (_t30.x - this.curr_pos.x < -60 && _t30.x - this.curr_pos.x > -70) {
                  this.arr_neibor[1] = _e19;
                } else {
                  _t30.x - this.curr_pos.x > 60 && _t30.x - this.curr_pos.x < 70 && (this.arr_neibor[2] = _e19);
                }
              }
            }
          }
          break;
        }
      }
    }
  }, {
    key: "onTouchMove",
    value: function onTouchMove(t) {
      if (this.cantouch && !this.IsGameOver && null != this.curr_nd) {
        var _e20 = t.getLocation();
        var _i15 = this.childs.convertToNodeSpaceAR(_e20);
        var _s22 = this.curr_pos.x - _i15.x;
        var _n18 = this.curr_pos.y - _i15.y;
        if (Math.abs(_s22) < this.item_wid && Math.abs(_n18) < this.item_hig) {
          if (Math.abs(_s22) > Math.abs(_n18)) {
            if (_i15.x > 32 && _i15.x < 682) {
              var _t31 = _i15.x;
              if (null == this.arr_neibor[1]) {
                _i15.x < this.curr_pos.x && (_t31 = this.curr_pos.x);
              } else {
                var _t32 = this.curr_nd.x - this.curr_pos.x;
                if (_t32 < 0) {
                  this.arr_neibor[1].opacity = 200 + 55 * (1 - Math.abs(_s22) / this.item_wid);
                  this.arr_neibor[1].getChildByName("baoshi").x = -_t32;
                } else {
                  this.arr_neibor[1].getChildByName("baoshi").x = 0;
                }
              }
              if (null == this.arr_neibor[2]) {
                _i15.x > this.curr_pos.x && (_t31 = this.curr_pos.x);
              } else {
                var _t33 = this.curr_nd.x - this.curr_pos.x;
                if (_t33 > 0) {
                  this.arr_neibor[2].opacity = 200 + 55 * (1 - Math.abs(_s22) / this.item_wid);
                  this.arr_neibor[2].getChildByName("baoshi").x = -_t33;
                } else {
                  this.arr_neibor[2].getChildByName("baoshi").x = 0;
                }
              }
              this.curr_nd.x = _t31;
              this.curr_nd.y = this.curr_pos.y;
            }
          } else if (_i15.y < -32 && _i15.y > -617) {
            var _t34 = _i15.y;
            if (null == this.arr_neibor[0]) {
              _i15.y > this.curr_pos.y && (_t34 = this.curr_pos.y);
            } else {
              var _t35 = this.curr_nd.y - this.curr_pos.y;
              if (_t35 > 0) {
                this.arr_neibor[0].opacity = 200 + 55 * (1 - Math.abs(_n18) / this.item_hig);
                this.arr_neibor[0].getChildByName("baoshi").y = -_t35;
              } else {
                this.arr_neibor[0].getChildByName("baoshi").y = 0;
              }
            }
            if (null == this.arr_neibor[3]) {
              _i15.y < this.curr_pos.y && (_t34 = this.curr_pos.y);
            } else {
              var _t36 = this.curr_nd.y - this.curr_pos.y;
              if (_t36 < 0) {
                this.arr_neibor[3].opacity = 200 + 55 * (1 - Math.abs(_n18) / this.item_hig);
                this.arr_neibor[3].getChildByName("baoshi").y = -_t36;
              } else {
                this.arr_neibor[3].getChildByName("baoshi").y = 0;
              }
            }
            this.curr_nd.y = _t34;
            this.curr_nd.x = this.curr_pos.x;
          }
        }
      }
    }
  }, {
    key: "onTouchEnd",
    value: function onTouchEnd(t) {
      if (this.cantouch && !this.IsGameOver && null != this.curr_nd) {
        for (var _t37 = 0; _t37 < this.childs.childrenCount; _t37++) {
          var _e21 = this.childs.children[_t37];
          if (this.curr_nd.name != _e21.name && $2ccUtil.default.checkWorldBox(this.curr_nd, _e21, .3)) {
            this.new_nd = _e21;
            break;
          }
        }
        if (null != this.new_nd) {
          if (this.curr_nd.getComponent($2gezi_2.default).color == this.new_nd.getComponent($2gezi_2.default).color) {
            this.reflash_curr();
          } else {
            this.swap_ndpos(this.curr_nd, this.new_nd);
            this.jiancesanlian();
          }
        } else {
          this.reflash_curr();
        }
      }
    }
  }, {
    key: "swap_ndpos",
    value: function swap_ndpos(t, e) {
      var i = t.getComponent($2gezi_2.default).startPos;
      var s = e.getComponent($2gezi_2.default).startPos;
      t.getChildByName("baoshi").setPosition(cc.v2(0, 0));
      t.setPosition(s);
      e.setPosition(i);
    }
  }, {
    key: "reflash_curr",
    value: function reflash_curr() {
      this.curr_nd.getComponent($2gezi_2.default).ischoose(false);
      this.curr_nd.getComponent($2gezi_2.default).guiwei();
      this.curr_nd.zIndex -= 100;
      this.curr_nd = null;
      this.curr_pos = cc.v2(0, 0);
      if (null != this.new_nd) {
        this.new_nd.getComponent($2gezi_2.default).guiwei();
        this.new_nd = null;
      }
      if (null != this.arr_neibor[0]) {
        this.arr_neibor[0].opacity = 255;
        this.arr_neibor[0].getChildByName("baoshi").setPosition(cc.v2(0, 0));
      }
      if (null != this.arr_neibor[1]) {
        this.arr_neibor[1].opacity = 255;
        this.arr_neibor[1].getChildByName("baoshi").setPosition(cc.v2(0, 0));
      }
      if (null != this.arr_neibor[2]) {
        this.arr_neibor[2].opacity = 255;
        this.arr_neibor[2].getChildByName("baoshi").setPosition(cc.v2(0, 0));
      }
      if (null != this.arr_neibor[3]) {
        this.arr_neibor[3].opacity = 255;
        this.arr_neibor[3].getChildByName("baoshi").setPosition(cc.v2(0, 0));
      }
      this.arr_neibor = [null, null, null, null];
    }
  }, {
    key: "jiancesanlian",
    value: function jiancesanlian() {
      var t = [];
      for (var _l2 = 0; _l2 < this.geziData.length; _l2++) {
        t[_l2] = [];
        for (var _e22 = 0; _e22 < this.geziData[_l2].length; _e22++) {
          t[_l2][_e22] = this.geziData[_l2][_e22];
        }
      }
      var e = false;
      var i = this.getNdIdByNd(this.curr_nd);
      var s = this.getPosById(i);
      var n = this.getNdIdByNd(this.new_nd);
      var a = this.getPosById(n);
      var r = this.geziData[s[0]][s[1]];
      this.geziData[s[0]][s[1]] = this.geziData[a[0]][a[1]];
      this.geziData[a[0]][a[1]] = r;
      var h = this.jiances(s);
      var o = this.jiances(a);
      (h || o) && (e = true);
      if (e) {
        this.curr_nd.getComponent($2gezi_2.default).setStartPos();
        null != this.new_nd && this.new_nd.getComponent($2gezi_2.default).setStartPos();
        for (var _t38 = 0; _t38 < this.deleteNds.length; _t38++) {
          this.CanMoveNodeArrs[this.deleteNds[_t38].getComponent($2gezi_2.default).id] = null;
          this.deleteNds[_t38].removeFromParent();
          this.deleteNds[_t38].parent = this.childs_eff;
          this.deleteNds[_t38].getComponent($2gezi_2.default).xiaoshi();
          this.deleteNds.splice(_t38, 1);
          _t38--;
        }
        this.playPublicSound("xiaochu");
        this.jianceRidgebody();
        this.reflash_curr();
      } else {
        this.geziData = t;
        this.reflash_curr();
      }
    }
  }, {
    key: "jianceRidgebody",
    value: function jianceRidgebody() {
      var t = 0;
      for (var _e23 = 0; _e23 < this.geziData.length; _e23++) {
        for (var _i16 = 0; _i16 < this.geziData[_e23].length; _i16++) {
          -1 == this.geziData[_e23][_i16][0] && (this.childs_r.getChildByName("".concat(t)).active = false);
          t++;
        }
      }
    }
  }, {
    key: "jiances",
    value: function jiances(t) {
      var e = [t];
      e = this.jiancexiangtongzuoshang(t[0], t[1], e);
      e = this.jiancexiangtongyouxia(t[0], t[1], e);
      this.quchong(e);
      return this.panduansanlian(e);
    }
  }, {
    key: "quchong",
    value: function quchong(t) {
      for (var _e24 = 0; _e24 < t.length - 1; _e24++) {
        for (var _i17 = _e24 + 1; _i17 < t.length; _i17++) {
          if (t[_e24][0] == t[_i17][0] && t[_e24][1] == t[_i17][1]) {
            t.splice(_i17, 1);
            _i17--;
          }
        }
      }
    }
  }, {
    key: "jiancexiangtongzuoshang",
    value: function jiancexiangtongzuoshang(t, e, i) {
      var s = this.geziData[t][e][0];
      if (t > 0 && s == this.geziData[t - 1][e][0]) {
        return i[i.length] = [t - 1, e], this.jiancexiangtongzuoshang(t - 1, e, i);
      } else {
        if (e > 0 && s == this.geziData[t][e - 1][0]) {
          return i[i.length] = [t, e - 1], this.jiancexiangtongzuoshang(t, e - 1, i);
        } else {
          return i;
        }
      }
    }
  }, {
    key: "jiancexiangtongyouxia",
    value: function jiancexiangtongyouxia(t, e, i) {
      var s = this.geziData[t][e][0];
      if (t < this.map_Hight - 1 && s == this.geziData[t + 1][e][0]) {
        return i[i.length] = [t + 1, e], this.jiancexiangtongzuoshang(t + 1, e, i);
      } else {
        if (e < this.map_Width - 1 && s == this.geziData[t][e + 1][0]) {
          return i[i.length] = [t, e + 1], this.jiancexiangtongzuoshang(t, e + 1, i);
        } else {
          return i;
        }
      }
    }
  }, {
    key: "jiancexiangtongzuo",
    value: function jiancexiangtongzuo(t, e, i) {
      var s = this.geziData[t][e][0];
      if (e > 0 && s == this.geziData[t][e - 1][0]) {
        var _s23 = [t, e - 1];
        var _n19 = false;
        for (var _t39 = 0; _t39 < i.length; _t39++) {
          i[_t39][0] == _s23[0] && i[_t39][1] == _s23[1] && (_n19 = true);
        }
        _n19 || (i[i.length] = _s23);
        return this.jiancexiangtongzuo(t, e - 1, i);
      }
      return i;
    }
  }, {
    key: "jiancexiangtongshang",
    value: function jiancexiangtongshang(t, e, i) {
      var s = this.geziData[t][e][0];
      if (t > 0 && s == this.geziData[t - 1][e][0]) {
        var _s24 = [t - 1, e];
        var _n20 = false;
        for (var _t40 = 0; _t40 < i.length; _t40++) {
          i[_t40][0] == _s24[0] && i[_t40][1] == _s24[1] && (_n20 = true);
        }
        _n20 || (i[i.length] = _s24);
        return this.jiancexiangtongshang(t - 1, e, i);
      }
      return i;
    }
  }, {
    key: "jiancexiangtongyou",
    value: function jiancexiangtongyou(t, e, i) {
      var s = this.geziData[t][e][0];
      if (e < this.map_Width - 1 && s == this.geziData[t][e + 1][0]) {
        var _s25 = [t, e + 1];
        var _n21 = false;
        for (var _t41 = 0; _t41 < i.length; _t41++) {
          i[_t41][0] == _s25[0] && i[_t41][1] == _s25[1] && (_n21 = true);
        }
        _n21 || (i[i.length] = _s25);
        return this.jiancexiangtongyou(t, e + 1, i);
      }
      return i;
    }
  }, {
    key: "jiancexiangtongxia",
    value: function jiancexiangtongxia(t, e, i) {
      var s = this.geziData[t][e][0];
      if (t < this.map_Hight - 1 && s == this.geziData[t + 1][e][0]) {
        var _s26 = [t + 1, e];
        var _n22 = false;
        for (var _t42 = 0; _t42 < i.length; _t42++) {
          i[_t42][0] == _s26[0] && i[_t42][1] == _s26[1] && (_n22 = true);
        }
        _n22 || (i[i.length] = _s26);
        return this.jiancexiangtongxia(t + 1, e, i);
      }
      return i;
    }
  }, {
    key: "panduansanlian",
    value: function panduansanlian(t) {
      var e = false;
      for (var _i18 = 0; _i18 < t.length; _i18++) {
        var _s27 = [t[_i18]];
        _s27 = this.jiancexiangtongzuo(t[_i18][0], t[_i18][1], _s27);
        _s27 = this.jiancexiangtongyou(t[_i18][0], t[_i18][1], _s27);
        var _n23 = [t[_i18]];
        _n23 = this.jiancexiangtongshang(t[_i18][0], t[_i18][1], _n23);
        _n23 = this.jiancexiangtongxia(t[_i18][0], t[_i18][1], _n23);
        this.quchong(_s27);
        this.quchong(_n23);
        if (_s27.length > 2) {
          e = true;
          for (var _t43 = 0; _t43 < _s27.length; _t43++) {
            var _e25 = this.geziData[_s27[_t43][0]][_s27[_t43][1]][1];
            if (-1 != _e25) {
              var _i19 = this.CanMoveNodeArrs[_e25];
              if (!_i19.getComponent($2gezi_2.default).isNeedDelete) {
                _i19.getComponent($2gezi_2.default).isNeedDelete = true;
                this.deleteNds[this.deleteNds.length] = _i19;
                this.geziData[_s27[_t43][0]][_s27[_t43][1]] = [-1, -1];
              }
            }
          }
        }
        if (_n23.length > 2) {
          e = true;
          for (var _t44 = 0; _t44 < _n23.length; _t44++) {
            var _e26 = this.geziData[_n23[_t44][0]][_n23[_t44][1]][1];
            if (-1 != _e26) {
              var _i20 = this.CanMoveNodeArrs[_e26];
              if (!_i20.getComponent($2gezi_2.default).isNeedDelete) {
                _i20.getComponent($2gezi_2.default).isNeedDelete = true;
                this.deleteNds[this.deleteNds.length] = _i20;
                this.geziData[_n23[_t44][0]][_n23[_t44][1]] = [-1, -1];
              }
            }
          }
        }
      }
      return e;
    }
  }, {
    key: "levelUpdate",
    value: function levelUpdate(t) {
      babel_get(babel_getPrototypeOf(_ctor.prototype), "levelUpdate", this).call(this, t);
      if (this.isStartChange) {
        this.gameTime += t;
        if (this.gameTime >= .016) {
          this.gameTime -= .016, this.pauseTime <= 0 ? this.changepos() : this.pauseTime -= t, this.jianceqius();
        }
      }
    }
  }, {
    key: "getNdIdByNd",
    value: function getNdIdByNd(t) {
      for (var _e27 = 0; _e27 < this.CanMoveNodeArrs.length; _e27++) {
        if (t == this.CanMoveNodeArrs[_e27]) {
          return _e27;
        }
      }
      return -1;
    }
  }, {
    key: "getPosById",
    value: function getPosById(t) {
      for (var _e28 = 0; _e28 < this.geziData.length; _e28++) {
        for (var _i21 = 0; _i21 < this.geziData[_e28].length; _i21++) {
          if (this.geziData[_e28][_i21][1] == t) {
            return [_e28, _i21];
          }
        }
      }
      return [-1, -1];
    }
  }, {
    key: "getNdByIdAndWay",
    value: function getNdByIdAndWay(t) {
      var e = this.getNdIdByNd(t);
      var i = null;
      if (-1 == e) {
        console.log("error");
      } else {
        var _t45 = this.getPosById(e);
        var _s28 = -1;
        switch (this.moveWay) {
          case 0:
            _t45[0] > 0 && (_s28 = this.geziData[_t45[0] - 1][_t45[1]][1]);
            break;
          case 1:
            _t45[0] < 9 && (_s28 = this.geziData[_t45[0] + 1][_t45[1]][1]);
            break;
          case 2:
            _t45[1] > 0 && (_s28 = this.geziData[_t45[0]][_t45[1] - 1][1]);
            break;
          case 3:
            _t45[1] < 10 && (_s28 = this.geziData[_t45[0]][_t45[1] + 1][1]);
        }
        -1 != _s28 && (i = this.CanMoveNodeArrs[_s28]);
      }
      return i;
    }
  }, {
    key: "jianceqius",
    value: function jianceqius() {
      var _this16 = this;
      for (var _e29 = 0; _e29 < this.qius.length; _e29++) {
        if (this.qius[_e29].getPosition().y < -700 || this.qius[_e29].getPosition().x > 240) {
          this.qius[_e29].destroy();
          this.qius[_e29].removeFromParent();
          this.qius.splice(_e29, 1);
          _e29--;
          this.curr_score++;
        }
      }
      this.curr_score >= this.need_score && (this.IsGameOver || (this.IsGameOver = true, this.isStartChange = false, this.playPublicSound("zhengque"), this.SpineArrs[f.man].setAnimation(0, "idle", true), this.node.getChildByName("hong").getComponent(cc.Animation).stop(), this.scheduleOnce(function () {
        _this16.complete();
      }, 2)));
      this.qiuNum.string = "消除".concat(this.need_score, "块石头：").concat(this.curr_score, "/").concat(this.need_score);
      var t = this.curr_score / this.need_score;
      this.jingdu.fillRange = t;
      $2Globe.default.getInstance().currlv_range = t;
    }
  }, {
    key: "changepos",
    value: function changepos() {
      var _this17 = this;
      var t = this.SceneArrs[p.yidongqiang2].getPosition();
      if (t.x > 188 && !this.is_shan) {
        this.is_shan = true;
        this.node.getChildByName("hong").getComponent(cc.Animation).play();
      }
      if (t.x > 238) {
        if (!this.IsGameOver) {
          this.IsGameOver = true, this.SpineArrs[f.man].setAnimation(0, "fail2", false), this.playPublicSound("jianjiaonan"), this.scheduleOnce(function () {
            _this17.gamefail();
          }, 1.5);
        }
      } else {
        t.x += this.speed;
        t.y -= this.speed / 3;
        this.SceneArrs[p.yidongqiang2].setPosition(t);
      }
    }
  }, {
    key: "dobomb",
    value: function dobomb(t) {
      var _this18 = this;
      this.scheduleOnce(function () {
        t.getComponent($2gezi_2.default).xiaoshi();
        _this18.jianceRidgebody();
      }, 1);
    }
  }, {
    key: "useProp",
    value: function useProp(t) {
      var _this19 = this;
      if ("bomb" == t) {
        var _t46 = false;
        var _e30 = null;
        var _i22 = 0;
        for (var _s29 = 0; _s29 < this.geziData.length; _s29++) {
          var _n24 = this.geziData[_s29].length;
          for (var _a5 = 0; _a5 < _n24; _a5++) {
            if (_a5 >= 0 && _a5 <= 3 && -1 != this.geziData[_s29][_a5][0]) {
              var _n25 = this.geziData[_s29][_a5][1];
              var _r3 = this.CanMoveNodeArrs[_n25];
              if (!_t46) {
                _t46 = true;
                _e30 = _r3.getPosition();
              }
              _r3.getComponent($2gezi_2.default).isNeedDelete || (_r3.getComponent($2gezi_2.default).isNeedDelete = true);
              this.geziData[_s29][_a5] = [-1, -1];
              _r3.removeFromParent();
              _r3.parent = this.childs_eff;
              this.dobomb(_r3);
              if (++_i22 >= 4) {
                break;
              }
            }
          }
          if (_i22 >= 4) {
            break;
          }
        }
        if (null != _e30) {
          this.bombani.opacity = 255;
          cc.tween(this.bombani).bezierTo(.9, cc.v2(116, 470), cc.v2(120, 470), _e30).to(.1, {
            opacity: 0
          }).call(function () {
            _this19.zhadan.node.setPosition(_e30);
            _this19.zhadan.node.active = true;
            _this19.zhadan.setAnimation(0, "go", false);
          }).call(function () {
            _this19.bombani.setPosition(cc.v2(116, 470));
          }).start();
        }
      } else if ("addtime" == t) {
        this.pauseTime < 0 && (this.pauseTime = 0);
        this.pauseTime += 30;
      }
    }
  }]);
}($2levelbase.default);
cc__decorate([ccp_property(Array(cc.Node))], def_level_game_3.prototype, "SceneArrs", undefined);
cc__decorate([ccp_property(Array(sp.Skeleton))], def_level_game_3.prototype, "SpineArrs", undefined);
cc__decorate([ccp_property(Array(cc.Prefab))], def_level_game_3.prototype, "ArrPres", undefined);
cc__decorate([ccp_property(cc.Label)], def_level_game_3.prototype, "qiuNum", undefined);
cc__decorate([ccp_property(cc.Sprite)], def_level_game_3.prototype, "jingdu", undefined);
cc__decorate([ccp_property(cc.Label)], def_level_game_3.prototype, "title", undefined);
cc__decorate([ccp_property(sp.SkeletonData)], def_level_game_3.prototype, "skin_spine", undefined);
cc__decorate([ccp_property(sp.Skeleton)], def_level_game_3.prototype, "zhadan", undefined);
cc__decorate([ccp_property(cc.Node)], def_level_game_3.prototype, "bombani", undefined);
def_level_game_3 = cc__decorate([ccp_ccclass], def_level_game_3);
exports.default = def_level_game_3;